<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- 比赛中的配对次数 -->
    <script>
      var number = function (n) {
        let count = 0
        while (n > 1) {
          if (n % 2 == 0) {
            n /= 2
            count += n
          } else {
            n = (n - 1) / 2
            count += n + 1
          }
        }
        return count
      }
      console.log(number(7))
      // console.log(number(14))
    </script>
  </body>
</html>
